package com.berchen.test;

import java.util.concurrent.CountDownLatch;

/**
 *
 */
public class CountDownLatchDemo {
    private static CountDownLatch downLatch=new CountDownLatch(10);
    public static void main(String[] args) throws InterruptedException {

        for (int i = 0; i <15 ; i++) {

            new Thread(()->{downLatch.countDown();
                System.out.println(Thread.currentThread().getName()+"正在运行，等到10线程执行完毕才会执行其他线程的东西");}).start();
        }

        downLatch.await();
        System.out.println("10个线程执行完毕");

    }

}
